package com.wffz.controller;

import com.wffz.comm.api.ResponseResult;
import com.wffz.po.ClientUser;
import com.wffz.service.PatchService;
import com.wffz.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;

/**
 * @author sunlei
 * @className PatchController
 * @Description
 * @date 2023-04-01 22:19
 **/
@RequestMapping("/patch")
@RestController
@Slf4j
public class PatchController {

    @Resource
    private PatchService patchService;

    @Resource
    private UserService userService;

    @GetMapping("/queryAwardPatch")
    public ResponseResult queryAwardPatch(HttpServletRequest request, String type) {
        Principal principal = request.getUserPrincipal();
        ClientUser clientUser = userService.findUserByUserName(principal.getName());
        return ResponseResult.success(patchService.queryAwardPatch(type));
    }
}
